<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>angular-依赖注入</title>
</head>
<body>
<div ng-app="app" ng-controller="testController">

</div>
</body>
<script src="../lib/angular-1.5.0/angular.js"></script>
<script>
    /**
     * 1. value
     * 2. factory
     * 3. service
     * 3. provider
     * 4. constant
     * */

    /**
     *  1. value
     * */
    // const app = angular.module('app',[]);
    // app.value('defaultValue',45);
    //
    // app.controller('testController',function ($scope,defaultValue) {
    // })

    /**
     *  2.factory
     * */

    const app = angular.module('app',[]);

    app.factory('MathService',function () {

        var instance ={};

        instance.multiply=function (a,b) {
            return a*b;
        }
        return instance;
    })

    app.service('CalService',function (MathService) {

        this.square=function (num) {
            return MathService.multiply(num,num);
        }
    })



    /**
     *  3.provider
     * */


    /**
     *  4. constant
     * */


    app.constant("configParam", "constant value");


</script>

</html>